#include <stdio.h>
int main()
{
    int i,n,m;
    float sum = 0.0;
    int front = 1;//需要变换的符号从3开始
    printf("请输入一个正整数：");
    scanf("%d",&n);

    for( i = 2; i <= n; i++)
        {
            sum += front * (1.0 / i);
            front = -front;
        }
    printf("结果：%f",sum + 1);
    return 0;

}